home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-11-20 | 19.8 KB | 2,074 lines |
- # 1 "blockframe.c"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "defs.h" 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- extern char *savestring ();
- extern char *concat ();
- extern char *xmalloc (), *xrealloc ();
- extern int parse_escape ();
- extern char *reg_names[];
-
-
-
-
-
-
-
-
-
-
-
-
- extern int quit_flag;
-
- extern int immediate_quit;
-
-
-
-
-
-
- enum command_class
- {
- no_class = -1, class_run = 0, class_vars, class_stack,
- class_files, class_support, class_info, class_breakpoint,
- class_alias, class_obscure, class_user,
- };
-
-
-
-
-
-
-
-
-
-
-
- struct cleanup
- {
- struct cleanup *next;
- void (*function) ();
- int arg;
- };
-
- extern void do_cleanups ();
- extern void discard_cleanups ();
- extern struct cleanup *make_cleanup ();
- extern struct cleanup *save_cleanups ();
- extern void restore_cleanups ();
- extern void free_current_contents ();
- extern void reinitialize_more_filter ();
- extern void fputs_filtered ();
- extern void fprintf_filtered ();
- extern void printf_filtered ();
- extern void print_spaces_filtered ();
- extern char *tilde_expand ();
-
-
-
-
- struct command_line
- {
- struct command_line *next;
- char *line;
- };
-
- struct command_line *read_command_lines ();
-
-
-
- char *current_directory;
-
- # 21 "blockframe.c" 2
-
-
- # 1 "symtab.h" 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "./obstack.h" 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- struct _obstack_chunk
- {
- char *limit;
- struct _obstack_chunk *prev;
- char contents[4];
- };
-
- struct obstack
- {
- long chunk_size;
- struct _obstack_chunk* chunk;
- char *object_base;
- char *next_free;
- char *chunk_limit;
- int temp;
- int alignment_mask;
- struct _obstack_chunk *(*chunkfun) ();
- void (*freefun) ();
- };
-
-
-
-
-
-
- void obstack_init (struct obstack *obstack);
-
- void * obstack_alloc (struct obstack *obstack, int size);
-
- void * obstack_copy (struct obstack *obstack, void *address, int size);
- void * obstack_copy0 (struct obstack *obstack, void *address, int size);
-
- void obstack_free (struct obstack *obstack, void *block);
-
- void obstack_blank (struct obstack *obstack, int size);
-
- void obstack_grow (struct obstack *obstack, void *data, int size);
- void obstack_grow0 (struct obstack *obstack, void *data, int size);
-
- void obstack_1grow (struct obstack *obstack, int data_char);
-
- void * obstack_finish (struct obstack *obstack);
-
- int obstack_object_size (struct obstack *obstack);
-
- int obstack_room (struct obstack *obstack);
- void obstack_1grow_fast (struct obstack *obstack, int data_char);
- void obstack_blank_fast (struct obstack *obstack, int size);
-
- void * obstack_base (struct obstack *obstack);
- void * obstack_next_free (struct obstack *obstack);
- int obstack_alignment_mask (struct obstack *obstack);
- int obstack_chunk_size (struct obstack *obstack);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 244 "./obstack.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 286 "./obstack.h"
-
-
-
-
-
-
-
-
- # 369 "./obstack.h"
-
-
-
-
- # 20 "symtab.h" 2
-
-
-
-
-
-
-
- extern struct obstack *symbol_obstack;
- extern struct obstack *psymbol_obstack;
-
-
-
-
- extern char *xmalloc ();
- extern void free ();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- enum misc_function_type {mf_unknown = 0, mf_text, mf_data, mf_bss, mf_abs};
-
- struct misc_function
- {
- char *name;
- unsigned int address;
- unsigned char type;
- };
-
-
-
- struct misc_function *misc_function_vector;
- int misc_function_count;
-
- # 1 "symseg.h" 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- enum language {language_c};
-
- struct symbol_root
- {
- int format;
- int length;
- int ldsymoff;
- int textrel;
- int datarel;
- int bssrel;
- char *filename;
- char *filedir;
- struct blockvector *blockvector;
- struct typevector *typevector;
- enum language language;
- char *version;
- char *compilation;
- int databeg;
- int bssbeg;
- struct sourcevector *sourcevector;
- };
-
-
-
-
-
-
- struct typevector
- {
- int length;
- struct type *type[1];
- };
-
-
-
- enum type_code
- {
- TYPE_CODE_UNDEF,
- TYPE_CODE_PTR,
- TYPE_CODE_ARRAY,
- TYPE_CODE_STRUCT,
- TYPE_CODE_UNION,
- TYPE_CODE_ENUM,
- TYPE_CODE_FUNC,
- TYPE_CODE_INT,
- TYPE_CODE_FLT,
- TYPE_CODE_VOID,
- TYPE_CODE_SET,
- TYPE_CODE_RANGE,
- TYPE_CODE_PASCAL_ARRAY,
-
-
- TYPE_CODE_MEMBER,
- TYPE_CODE_METHOD,
- TYPE_CODE_REF,
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- struct type
- {
-
- enum type_code code;
-
-
-
- char *name;
-
- int length;
-
-
-
-
-
- struct type *target_type;
-
-
-
-
- struct type *pointer_type;
-
- struct type *reference_type;
- struct type **arg_types;
-
-
-
-
-
- struct type *function_type;
-
-
-
-
-
-
-
-
- struct type *main_variant, *next_variant;
-
-
- short flags;
-
- short nfields;
-
-
-
-
-
-
-
-
-
-
-
- struct field
- {
-
-
-
-
- int bitpos;
-
-
-
- int bitsize;
-
-
-
- struct type *type;
-
-
- char *name;
- } *fields;
-
-
- int *private_field_bits;
- int *protected_field_bits;
-
-
- short nfn_fields;
-
- short n_baseclasses;
-
-
-
- int nfn_fields_total;
-
-
-
-
-
- struct fn_fieldlist
- {
-
- char *name;
-
- int length;
-
- struct fn_field
- {
-
-
-
-
-
- struct type *type;
-
- struct type **args;
-
- char *physname;
-
-
- int voffset;
- } *fn_fields;
-
- int *private_fn_field_bits;
- int *protected_fn_field_bits;
-
- } *fn_fieldlists;
-
- unsigned char via_protected;
- unsigned char via_public;
-
-
-
-
-
-
-
-
-
- struct type *vptr_basetype;
-
- int vptr_fieldno;
-
-
-
-
-
-
-
-
-
-
- struct type **baseclasses;
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- struct blockvector
- {
-
- int nblocks;
-
- struct block *block[1];
- };
-
- struct block
- {
-
-
-
-
- int startaddr, endaddr;
-
-
-
-
-
-
-
-
-
- struct symbol *function;
-
-
-
-
-
-
- struct block *superblock;
-
-
-
-
-
- unsigned char gcc_compile_flag;
-
- int nsyms;
-
- struct symbol *sym[1];
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- enum namespace
- {
- UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE, LABEL_NAMESPACE,
- };
-
-
-
- enum address_class
- {
- LOC_UNDEF,
- LOC_CONST,
- LOC_STATIC,
- LOC_REGISTER,
- LOC_ARG,
- LOC_REF_ARG,
-
- LOC_REGPARM,
- LOC_LOCAL,
- LOC_TYPEDEF,
-
-
- LOC_LABEL,
- LOC_BLOCK,
-
- LOC_EXTERNAL,
-
-
-
-
- LOC_CONST_BYTES
- };
-
- struct symbol
- {
-
- char *name;
-
- enum namespace namespace;
-
- enum address_class class;
-
- struct type *type;
-
-
- union
- {
- long value;
- struct block *block;
- char *bytes;
- }
- value;
- };
-
- struct partial_symbol
- {
-
- char *name;
-
- enum namespace namespace;
-
- enum address_class class;
-
-
-
-
-
- union
- {
- long value;
- }
- value;
- };
-
-
-
-
-
- extern struct psymbol_allocation_list {
- struct partial_symbol *list, *next;
- int size;
- } global_psymbols, static_psymbols;
-
-
-
-
-
-
- struct sourcevector
- {
- int length;
- struct source *source[1];
- };
-
-
-
-
-
-
-
-
-
-
-
- struct linetable_entry
- {
- int line;
- unsigned int pc;
- };
-
- struct linetable
- {
- int nitems;
- struct linetable_entry item[1];
- };
-
-
-
- struct source
- {
- char *name;
- struct linetable contents;
- };
- # 64 "symtab.h" 2
-
-
-
-
-
- struct symtab
- {
-
- struct symtab *next;
-
- struct blockvector *blockvector;
-
- struct linetable *linetable;
-
- struct typevector *typevector;
-
- char *filename;
-
-
-
-
-
- enum free_code {free_nothing, free_contents, free_linetable}
- free_code;
-
- char *free_ptr;
-
- int nlines;
-
- int *line_charpos;
-
- enum language language;
-
- char *version;
-
- char *compilation;
-
-
- int ldsymoff;
-
-
- char *fullname;
- };
-
-
-
-
-
-
-
- struct partial_symtab
- {
-
- struct partial_symtab *next;
-
- char *filename;
-
-
-
-
-
-
-
- int ldsymoff, ldsymlen;
-
-
- int textlow, texthigh;
-
-
- unsigned char readin;
-
-
-
-
- struct partial_symtab **dependencies;
- int number_of_dependencies;
-
-
-
-
- int globals_offset, n_global_syms;
-
-
-
-
-
-
- int statics_offset, n_static_syms;
- };
-
-
-
- struct symtab *symtab_list;
-
-
-
- struct partial_symtab *partial_symtab_list;
-
-
-
- struct symtab *current_source_symtab;
-
-
-
- int current_source_line;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- extern struct symtab *lookup_symtab ();
- extern struct symbol *lookup_symbol ();
- extern struct type *lookup_typename ();
- extern struct type *lookup_unsigned_typename ();
- extern struct type *lookup_struct ();
- extern struct type *lookup_union ();
- extern struct type *lookup_enum ();
- extern struct type *lookup_struct_elt_type ();
- extern struct type *lookup_pointer_type ();
- extern struct type *lookup_function_type ();
- extern struct type *lookup_basetype_type ();
- extern struct type *create_array_type ();
- extern struct symbol *block_function ();
- extern struct symbol *find_pc_function ();
- extern int find_pc_partial_function ();
- extern struct partial_symtab *find_pc_psymtab ();
- extern struct symtab *find_pc_symtab ();
- extern struct partial_symbol *find_pc_psymbol ();
- extern int find_pc_misc_function ();
-
-
- extern struct type *lookup_reference_type ();
- extern struct type *lookup_member_type ();
- extern struct type *lookup_class ();
-
-
- extern struct type *builtin_type_void;
- extern struct type *builtin_type_char;
- extern struct type *builtin_type_short;
- extern struct type *builtin_type_int;
- extern struct type *builtin_type_long;
- extern struct type *builtin_type_unsigned_char;
- extern struct type *builtin_type_unsigned_short;
- extern struct type *builtin_type_unsigned_int;
- extern struct type *builtin_type_unsigned_long;
- extern struct type *builtin_type_float;
- extern struct type *builtin_type_double;
-
- # 334 "symtab.h"
-
-
-
-
-
-
-
-
-
-
-
-
- struct symtab_and_line
- {
- struct symtab *symtab;
- int line;
- unsigned int pc;
- unsigned int end;
- };
-
- struct symtabs_and_lines
- {
- struct symtab_and_line *sals;
- int nelts;
- };
-
-
-
-
-
- struct symtab_and_line find_pc_line ();
-
-
-
-
- struct symtabs_and_lines decode_line_spec ();
- struct symtabs_and_lines decode_line_spec_1 ();
- struct symtabs_and_lines decode_line_1 ();
- # 23 "blockframe.c" 2
-
- # 1 "frame.h" 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- typedef struct frame_info *FRAME;
- typedef unsigned int FRAME_ADDR;
-
-
-
-
-
-
-
-
-
-
-
-
- struct frame_info
- {
-
- FRAME_ADDR frame;
-
-
-
- unsigned int pc;
-
-
-
-
- FRAME_ADDR next_frame;
-
-
-
-
-
-
- FRAME next, prev;
- };
-
-
-
- struct frame_saved_regs
- {
-
-
- unsigned int regs[NUM_REGS];
- };
-
-
-
-
- extern FRAME selected_frame;
-
- extern struct frame_info *get_frame_info ();
- extern struct frame_info *get_prev_frame_info ();
-
- extern FRAME create_new_frame ();
-
- extern void get_frame_saved_regs ();
-
- extern FRAME get_prev_frame ();
- extern FRAME get_current_frame ();
- extern FRAME get_next_frame ();
-
- extern struct block *get_frame_block ();
- extern struct block *get_current_block ();
- extern struct block *get_selected_block ();
- extern struct symbol *get_frame_function ();
- extern struct symbol *get_pc_function ();
-
-
- extern FRAME find_relative_frame ();
-
-
-
- # 24 "blockframe.c" 2
-
-
- # 1 "./obstack.h" 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 371 "./obstack.h"
-
-
- # 26 "blockframe.c" 2
-
-
-
-
-
-
-
-
-
-
- unsigned int startup_file_start;
- unsigned int startup_file_end;
-
-
- int
- outside_startup_file (addr)
- unsigned int addr;
- {
- return !(addr >= startup_file_start && addr < startup_file_end);
- }
-
-
-
- static FRAME current_frame;
-
- struct block *block_for_pc ();
- unsigned int get_pc_function_start ();
-
-
-
-
-
-
- struct obstack frame_cache_obstack;
-
-
-
- FRAME
- get_current_frame ()
- {
-
-
-
- return current_frame;
- }
-
- void
- set_current_frame (frame)
- FRAME frame;
- {
- current_frame = frame;
- }
-
- FRAME
- create_new_frame (addr, pc)
- FRAME_ADDR addr;
- unsigned int pc;
- {
- struct frame_info *fci;
-
- fci = (struct frame_info *)
- ({ struct obstack *__h = (&frame_cache_obstack); ({ struct obstack *__o = (__h); int __len = ( (
- sizeof (struct frame_info))); ((__o->next_free + __len > __o->chunk_limit) ? _obstack_newchunk (__o, __len) : 0); __o->next_free += __len; (void) 0; }) ; ({ struct obstack *__o = (__h); void *value = (void *) __o->object_base; __o->next_free = (((((__o->next_free) - (char *)0) +__o->alignment_mask) & ~ (__o->alignment_mask)) + (char *)0) ; ((__o->next_free - (char *)__o->chunk > __o->chunk_limit - (char *)__o->chunk) ? (__o->next_free = __o->chunk_limit) : 0); __o->object_base = __o->next_free; value; }) ; }) ;
-
-
- fci->next = (struct frame_info *) 0;
- fci->prev = (struct frame_info *) 0;
- fci->frame = addr;
- fci->next_frame = 0;
- fci->pc = pc;
-
-
-
-
-
- return fci;
- }
-
-
-
-
- FRAME
- get_prev_frame (frame)
- FRAME frame;
- {
-
-
- return get_prev_frame_info (frame);
- }
-
-
-
-
- FRAME
- get_next_frame (frame)
- FRAME frame;
- {
-
-
- return frame->next;
- }
-
-
-
-
- void
- flush_cached_frames ()
- {
-
- ({ struct obstack *__o = (&frame_cache_obstack); void *__obj = ( 0); if (__obj >= (void *)__o->chunk && __obj < (void *)__o->chunk_limit) __o->next_free = __o->object_base = __obj; else (obstack_free) (__o, __obj); }) ;
- _obstack_begin ((&frame_cache_obstack), 0, 0, xmalloc , free ) ;
-
- current_frame = (struct frame_info *) 0;
- }
-
-
-
-
-
-
-
-
- struct frame_info *
- get_frame_info (frame)
- FRAME frame;
- {
- return frame;
- }
-
-
-
-
-
-
-
-
-
-
- # 181 "blockframe.c"
-
-
-
-
-
- struct frame_info *
- get_prev_frame_info (next_frame)
- FRAME next_frame;
- {
- FRAME_ADDR address;
- struct frame_info *prev;
- int fromleaf = 0;
-
-
-
-
-
- if (!next_frame)
- {
- if (!current_frame)
- {
- if (!have_inferior_p () && !have_core_file_p ())
- fatal ("get_prev_frame_info: Called before cache primed. \"Shouldn't happen.\"");
- else
- error ("No inferior or core file.");
- }
-
- return current_frame;
- }
-
-
- if (next_frame->prev)
- return next_frame->prev;
-
-
-
-
-
-
- # 230 "blockframe.c"
-
-
- if (!fromleaf)
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
- address = FRAME_CHAIN (next_frame);
- if (!FRAME_CHAIN_VALID (address, next_frame))
- return 0;
-
-
- address = FRAME_CHAIN_COMBINE (address, next_frame);
- }
-
- prev = (struct frame_info *)
- ({ struct obstack *__h = (&frame_cache_obstack); ({ struct obstack *__o = (__h); int __len = ( (
- sizeof (struct frame_info))); ((__o->next_free + __len > __o->chunk_limit) ? _obstack_newchunk (__o, __len) : 0); __o->next_free += __len; (void) 0; }) ; ({ struct obstack *__o = (__h); void *value = (void *) __o->object_base; __o->next_free = (((((__o->next_free) - (char *)0) +__o->alignment_mask) & ~ (__o->alignment_mask)) + (char *)0) ; ((__o->next_free - (char *)__o->chunk > __o->chunk_limit - (char *)__o->chunk) ? (__o->next_free = __o->chunk_limit) : 0); __o->object_base = __o->next_free; value; }) ; }) ;
-
- if (next_frame)
- next_frame->prev = prev;
- prev->next = next_frame;
- prev->prev = (struct frame_info *) 0;
- prev->frame = address;
- prev->next_frame = prev->next ? prev->next->frame : 0;
-
-
-
-
-
-
-
-
- prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (next_frame) :
- next_frame ? FRAME_SAVED_PC (next_frame) : read_pc ());
-
- return prev;
- }
-
- unsigned int
- get_frame_pc (frame)
- FRAME frame;
- {
- struct frame_info *fi;
- fi = get_frame_info (frame);
- return fi->pc;
- }
-
-
-
- void
- get_frame_saved_regs (frame_info_addr, saved_regs_addr)
- struct frame_info *frame_info_addr;
- struct frame_saved_regs *saved_regs_addr;
- {
- FRAME_FIND_SAVED_REGS (frame_info_addr, *saved_regs_addr);
- }
-
-
-
-
- struct block *
- get_frame_block (frame)
- FRAME frame;
- {
- struct frame_info *fi;
- unsigned int pc;
-
- fi = get_frame_info (frame);
-
- pc = fi->pc;
- if (fi->next_frame != 0)
-
-
-
-
-
- --pc;
- return block_for_pc (pc);
- }
-
- struct block *
- get_current_block ()
- {
- return block_for_pc (read_pc ());
- }
-
- unsigned int
- get_pc_function_start (pc)
- unsigned int pc;
- {
- register struct block *bl = block_for_pc (pc);
- register struct symbol *symbol;
- if (bl == 0 || (symbol = block_function (bl)) == 0)
- {
- register int misc_index = find_pc_misc_function (pc);
- if (misc_index >= 0)
- return misc_function_vector[misc_index].address;
- return 0;
- }
- bl = (symbol)->value.block ;
- return (bl)->startaddr ;
- }
-
-
-
- struct symbol *
- get_frame_function (frame)
- FRAME frame;
- {
- register struct block *bl = get_frame_block (frame);
- if (bl == 0)
- return 0;
- return block_function (bl);
- }
-
-
-
-
- extern struct symtab *psymtab_to_symtab ();
-
- struct block *
- block_for_pc (pc)
- register unsigned int pc;
- {
- register struct block *b;
- register int bot, top, half;
- register struct symtab *s;
- register struct partial_symtab *ps;
- struct blockvector *bl;
-
-
-
- for (s = symtab_list; s; s = s->next)
- {
- bl = (s)->blockvector ;
- b = (bl)->block[ 0] ;
- if ((b)->startaddr <= pc
- && (b)->endaddr > pc)
- break;
- }
-
- if (s == 0)
- for (ps = partial_symtab_list; ps; ps = ps->next)
- {
- if (ps->textlow <= pc
- && ps->texthigh > pc)
- {
- if (ps->readin)
- fatal ("Internal error: pc found in readin psymtab and not in any symtab.");
- s = psymtab_to_symtab (ps);
- bl = (s)->blockvector ;
- b = (bl)->block[ 0] ;
- break;
- }
- }
-
- if (s == 0)
- return 0;
-
-
-
-
- bot = 0;
- top = (bl)->nblocks ;
-
- while (top - bot > 1)
- {
- half = (top - bot + 1) >> 1;
- b = (bl)->block[ bot + half] ;
- if ((b)->startaddr <= pc)
- bot += half;
- else
- top = bot + half;
- }
-
-
-
- while (bot >= 0)
- {
- b = (bl)->block[ bot] ;
- if ((b)->endaddr > pc)
- return b;
- bot--;
- }
-
- return 0;
- }
-
-
-
-
- struct symbol *
- find_pc_function (pc)
- unsigned int pc;
- {
- register struct block *b = block_for_pc (pc);
- if (b == 0)
- return 0;
- return block_function (b);
- }
-
-
-
-
-
-
-
-
- int
- find_pc_partial_function (pc, name, address)
- unsigned int pc;
- char **name;
- unsigned int *address;
- {
- struct partial_symtab *pst = find_pc_psymtab (pc);
- struct symbol *f;
- int miscfunc;
- struct partial_symbol *psb;
-
- if (pst)
- {
- if (pst->readin)
- {
-
-
-
- f = find_pc_function (pc);
- if (!f)
- {
- return_error:
-
- if (name != 0)
- *name = 0;
- if (address != 0)
- *address = 0;
- return 0;
- }
-
- if (name)
- *name = (f)->name ;
- if (address)
- *address = ((f)->value.block )->startaddr ;
- return 1;
- }
-
-
-
-
- miscfunc = find_pc_misc_function (pc);
- psb = find_pc_psymbol (pst, pc);
-
- if (!psb && miscfunc == -1)
- {
- goto return_error;
- }
- if (!psb
- || (miscfunc != -1
- && ((psb)->value.value
- < misc_function_vector[miscfunc].address)))
- {
- if (address)
- *address = misc_function_vector[miscfunc].address;
- if (name)
- *name = misc_function_vector[miscfunc].name;
- return 1;
- }
- else
- {
- if (address)
- *address = (psb)->value.value ;
- if (name)
- *name = (psb)->name ;
- return 1;
- }
- }
- else
-
- {
- miscfunc = find_pc_misc_function (pc);
- if (miscfunc == -1)
- goto return_error;
- if (address)
- *address = misc_function_vector[miscfunc].address;
- if (name)
- *name = misc_function_vector[miscfunc].name;
- return 1;
- }
- }
-
-
-
-
-
- int
- find_pc_misc_function (pc)
- register unsigned int pc;
- {
- register int lo = 0;
- register int hi = misc_function_count-1;
- register int new;
- register int distance;
-
-
-
-
-
-
-
- if (hi < 0) return -1;
-
-
- if (pc < misc_function_vector[0].address ||
- pc > misc_function_vector[hi].address)
- return -1;
-
-
-
-
-
-
- do {
- new = (lo + hi) >> 1;
- distance = misc_function_vector[new].address - pc;
- if (distance == 0)
- return new;
- else if (distance > 0)
- hi = new;
- else
- lo = new;
- } while (hi-lo != 1);
-
-
- return lo;
- }
-
-
-
-
- FRAME
- block_innermost_frame (block)
- struct block *block;
- {
- struct frame_info *fi;
- register FRAME frame;
- register unsigned int start = (block)->startaddr ;
- register unsigned int end = (block)->endaddr ;
-
- frame = 0;
- while (1)
- {
- frame = get_prev_frame (frame);
- if (frame == 0)
- return 0;
- fi = get_frame_info (frame);
- if (fi->pc >= start && fi->pc < end)
- return frame;
- }
- }
-
- void
- _initialize_blockframe ()
- {
- _obstack_begin ((&frame_cache_obstack), 0, 0, xmalloc , free ) ;
- }
-